package com.wbt.spring.event;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author daojin
 * @date 2022/4/1 11:08 上午
 * 自定义邮件服务监听器
 * 该类实现了容器事件规范定义的监听器接口,通过泛型参数指定对上面定义的任务结束事件进行监听,通过@Component注解向容器进行注册
 */
@Component
public class MailTaskFinishListener implements ApplicationListener<TaskFinishEvent> {

    private String emial="takumiCX@163.com";

    @Override
    public void onApplicationEvent(TaskFinishEvent event) {
        System.out.println("Send Emial to "+emial+" Task:"+event.getSource());
    }
}
